extends Panel

signal date_update

onready var year_input = get_node('vbox/date_box/year')
onready var month_input = get_node('vbox/date_box/month')
onready var day_input = get_node('vbox/date_box/day')

func _ready():
	pass

func _notification(what):
	if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST:
		close()

func close():
	hide()

func show_date(dt):
	year_input.set_value(dt.year)
	month_input.set_value(dt.month)
	day_input.set_value(dt.day)
	show()
	get_tree().set_auto_accept_quit(false)

func update_date():
	var yy = int(year_input.get_value())
	var mm = int(month_input.get_value())
	var dd = int(day_input.get_value())
	emit_signal('date_update', yy, mm, dd)
	close()